.Button {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  padding: 0 0.875rem;
  margin: 0;
  outline: 0;
  border: 1px solid var(--color-gray-200);
  border-radius: 0.375rem;
  background-color: var(--color-gray-50);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5rem;
  color: var(--color-gray-900);
  user-select: none;

  @media (hover: hover) {
    &:hover {
      background-color: var(--color-gray-100);
    }
  }

  &:active {
    background-color: var(--color-gray-100);
  }

  &:focus-visible {
    outline: 2px solid var(--color-blue);
    outline-offset: -1px;
  }
}

.Backdrop {
  position: fixed;
  min-height: 100dvh;
  inset: 0;
  background-color: black;
  opacity: 0.7;
  backdrop-filter: blur(2px);
  transition:
    opacity 150ms,
    backdrop-filter 150ms;

  /* iOS 26+: Ensure the backdrop covers the entire visible viewport. */
  @supports (-webkit-touch-callout: none) {
    position: absolute;
  }

  @media (prefers-color-scheme: dark) {
    opacity: 0.7;
  }

  &[data-starting-style],
  &[data-ending-style] {
    opacity: 0;
  }
}

.Viewport {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2.5rem 1rem;

  @media (min-width: 80rem) {
    padding-block: 1.5rem;
  }
}

.PopupRoot {
  display: flex;
  justify-content: center;
  width: 100%;
  height: 100%;
  transition: opacity 150ms;
  pointer-events: none;

  &[data-starting-style],
  &[data-ending-style] {
    opacity: 0;
  }
}

.Popup {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: 70rem;
  padding: 1.5rem;
  border-radius: 0.5rem;
  pointer-events: auto;
  outline: 1px solid var(--color-gray-200);
  background-color: var(--color-gray-50);
  color: var(--color-gray-900);
  transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1);

  @media (prefers-color-scheme: dark) {
    outline: 1px solid var(--color-gray-300);
  }

  [data-starting-style] & {
    transform: scale(1.1);
  }
}

.Close {
  box-sizing: border-box;
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  border: none;
  color: var(--color-gray-50);
  border-radius: 0.375rem;

  @media (prefers-color-scheme: dark) {
    color: var(--color-gray-900);
  }

  &:focus-visible {
    outline: 2px solid var(--color-gray-50);
    outline-offset: -1px;

    @media (prefers-color-scheme: dark) {
      outline-color: var(--color-gray-900);
    }
  }

  @media (hover: hover) {
    &:hover {
      background-color: rgb(255 255 255 / 0.1);
    }
  }

  @media (min-width: 80rem) {
    top: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
  }
}

.CloseIcon {
  width: 2rem;
  height: 2rem;
}
